IBM System/370 VM/CMS Kermit 4.2.n Installation Instructions
                     (1993 June)
 
The following instructions, aside from steps 1, 7, and 8, are collected
into an EXEC for ease of application.  See the end of this file.
 
                  * * Installation Procedure * *
 
1) Get the necessary files from the Kermit distribution tape or from
   BITNET KERMSRV or elsewhere onto your A disk.  Be sure you have
   plenty of disk space for the installation (required: about 10 MB,
   including scratch space and the executables).  Note that many of the
   files are generic for Kermit-370 and may already be available from a
   local MVS/TSO site.  As distributed by Columbia, the files are named
   as follows, all with prefix IKC or IK0 (I K Zero):
 
   IKCAUX.CMD  Sample EXEC's PC, KERMAIL, etc.
   IKCBOO.ASM  Assembler source for Kermit bootstrap program
   IKCFIX.EXEC Repair kit for mail gateway damage
   IKCKER.BWR  A "beware" file, listing known bugs, problems, and fixes
   IKCKER.DOC  CMS Kermit User Guide, plain text
   IKCKER.HLP  Kermit-CMS help file, CMS HELP (Script) format
   IKCKER.INS  Kermit-CMS installation instructions (this file)
   IKCKER.UPD  Updates for CMS version of Kermit-370
   IKCMAC.ASM  Assembler source for CMS-specific macros
   IKCUTL.ASM  Assembler source for CMS-specific routines
   IKCXA.UPD   Further updates for CMS/XA variant of Kermit-370
   IK0CMD.ASM  Assembler source for command handler
   IK0COM.ASM  Assembler source for global code
   IK0DEF.ASM  Assembler source for parameter definitions
   IK0DOC.ASM  Assembler source with brief history
   IK0KAN.ASM  Assembler source for Kanji character translation
   IK0KER.BWR  Another "beware" file, with generic entries
   IK0MAC.ASM  Assembler source for generic Kermit macros
   IK0MAI.ASM  Assembler source for storage initialization
   IK0PRO.ASM  Assembler source for generic routines
 
   The following files are not necessary for installation, but may be of
   some interest.
 
   IKCACT.ASM  Assembler source for sample accounting exit routine
   IKCGUP.ASM  Assembler source for CMS-specific part of GUPI
   IKCHDR.MSS  Scribe source for producing IKCKER.DOC
   IKCKER.ANN  Text of Kermit-CMS announcement for current version
   IKCKER.LPT  Same as IKCKER.DOC, but with carriage control in col 1
   IKCKER.MSS  Scribe source for CMS part of IKCKER.DOC
   IKCKER.PS   PostScript equivalent of IKCKER.DOC
   IK0AAA.HLP  Kermit-370 implementation notes, supported environments
   IK0CON.HLP  Notes on supporting other terminal controllers
   IK0GUP.ASM  Assembler source for generic update program GUPI
   IK0KER.ANN  Text of generic Kermit-370 4.2 announcement
   IK0KER.MSS  Scribe source for generic part of IKCKER.DOC
   IK0KER.UPD  Update history for Kermit-370
   IK0POR.HLP  Notes on porting Kermit-370 to other systems
   IK0VER.FOR  Comparison program for generating update decks
 
2) Rename and reformat, if necessary, the source files on the A disk.
   If you received the program from Columbia on tape or over a network,
   the assembler source filenames are probably all IKxxxx and the
   filetype ASM.  Logically, these are concatenated into a single file
   called KERMIT ASSEMBLE (plus a few others).  This step is included in
   the installation EXEC.  If you got the source files via e-mail, they
   may have been reversibly corrupted by passage through various mail
   gateways.  Use IKCFIX to repair such damage before proceeding with
   the installation.
 
3) Rename and reformat, if necessary, the help file.  The file IKCKER
   HLP should generally be stored under the name KERMIT HELPCMS on the
   same minidisk as the executable KERMIT MODULE, so that on-line help
   will always be available and, in particular, so that the CMS HELP
   KERMIT command and Kermit-CMS's HELP subcommand can find it.  This
   step is also included in the EXEC, along with an option to install
   help menus for CMS HELP KER.  You may, in fact, install *only* the
   help files using the EXEC.
 
   The most comprehensive documentation is the pair of chapters of the
   Kermit User Guide dealing with CMS, namely, the generic Kermit-370
   chapter and the CMS-specific one.  These two are bundled together in
   IKCKER.DOC and also in IKCKER.PS; the PostScript is suitable only for
   printing, but the DOC file could also be stored wherever you keep
   online documentation files, renamed appropriately.
 
4) GLOBAL the necessary MACLIBs.  If you use VMFASM or VMFHASM or the
   installation EXEC, the GLOBAL command is issued automatically.  Under
   CMS releases 1 through 5.5 and 6, the MACLIBs are DMSSP, CMSLIB,
   TSOMAC, and OSMACRO.  Under CMS 5.6 and 7 or higher, they are DMSOM,
   DMSGPI, and OSMACRO.
 
5) Assemble the source files:
 
   ASSEMBLE KERMIT         (or HASM, for CMS/SP 5.5 or later)
   ASSEMBLE KERMBOOT       (Not necessary if using CMS/SP 4 or later)
   ASSEMBLE KACCT          (if desired)
 
   Note, however, that the base source files are typically not the
   latest version available.  Indeed, for releases 5.5 on up, you will
   need to apply updates anyway.  IKCKER BWR has instructions on how to
   do so, and the intallation EXEC automatically applies them, including
   any local updates you have collected into a file called KERMIT LOCAL.
 
6) There are 4 choices for installing the runnable modules, of which the
   first (and best) is available starting with VM/SP Release 4.  This
   choice is made automatically in the EXEC.
 
    a) With VM/SP Release 4 and later, create a dual-purpose module.
 
       LOAD KERMIT exits (RLDSAVE
       GENMOD KERMIT
 
       where "exits" is the list of desired exit routines, such as
       KACCT.
 
       The module created this way may be permanently pre-loaded by
       the user as follows:
 
       NUCXLOAD KERMIT
 
       Such a pre-loaded module is always dropped when CMS encounters
       an "ABEND" and it can also be removed (e.g., for replacement)
       by issuing the following command:
 
       NUCXDROP KERMIT
 
    b) If your installation is below release 4 of VM/SP, you might just
       install the Kermit-CMS program alone, to run in user memory.
       This means it can't invoke some programs (see the DOC file for
       more information about this).
 
       LOAD KERMIT
       GENMOD KERMIT
 
    c) Install the Kermit bootstrap program alone.  This loads the
       KERMIT TEXT object file into high memory, allowing it to invoke
       any other program:
 
       LOAD KERMBOOT
       GENMOD KERMIT
 
    d) Install both, to give users a choice:
 
       LOAD KERMIT
       GENMOD KERMIT
       LOAD KERMBOOT
       GENMOD KERMBOOT
 
       Note: with VM/SP Release 5, KERMBOOT will no longer work, and
       method (a) is the only recommended one.
 
7) Install any desired auxilliary commands from IKCAUX CMD.  These are
   sample EXEC's and may need to be tailored to your site.  The PC EXEC,
   for example, assumes that the TERMINALR macro is defined in your PC
   Kermit as "SERVER,CONNECT".  KERMAIL and KERMPRT must be set up
   according to the local options and facilities for e-mail and print,
   respectively.
 
8)  To run Kermit-CMS, simply type "KERMIT" to the CMS system prompt.
 
                    * * Accounting Routine * *
 
If you wish to use the optional accounting exit routine with Kermit, you
may do so by answering YES to that question from the installation EXEC.
Before assembling KACCT, you should examine the source and customize it
to your installation's needs, preferably by collecting your changes into
an update file called IKCACT UPD, which will automatically be applied by
the EXEC during installation.
 
                       * * Configuration * *
 
The IBM mainframe and its communications front end (3705, 7171, etc.)
usually require that parity be used by any asynchronous ASCII device
that wishes to communicate with it.  Exactly which kind of parity is
site-dependent.  At Columbia, the 3705 requires Mark parity, and the
7171 requires Even parity.  Make sure your users know to use the
appropriate parity setting, as well as any other settings required for
IBM mainframe communication (see p.36-39 of the Kermit book).
 
For linemode transfers, the ASCII/EBCDIC translation in the front end is
a key factor.  Kermit-CMS uses an ASCII/EBCDIC translation table which
conforms to the one given in the IBM System/370 Reference Summary.  If
your site's translation table is incompatible with the one Kermit uses,
then enter the appropriate SET ATOE/ETOA/TATOE/TETOA subcommands in the
SYSTEM KERMINI file.  As long as the system tables are invertible with
respect to the printable ASCII characters (even if the A-to-E and E-to-A
tables are not the inverses of each other), the SET subcommands can
compensate.  However, if your system's ASCII/EBCDIC tables are not
invertible, Kermit will not and cannot work; you must change your
system's tables.  Refer to the generic Kermit-370 chapter of the User's
Guide for a step-by-step customization procedure (see the section on
translation tables).
 
Kermit-CMS operation is possible for most types of protocol converters;
for best results, the converter should have a transparent mode.  If
possible, be sure the converter is configured so that the graphics or
transparent mode, whatever it is called, is enabled.  See IK0AAA.HLP for
a list of front ends that are known to work and for a collection of
notes and special warnings about some of them.  Some further
installation details follow for specific devices.
 
When CMS Kermit is to be used with a 7171, make sure the 7171 is set
up with its "keyboard lock delay" parameter set to 0.  Otherwise, the
"terminal" will hang whenever CMS Kermit clears the screen.  This
happens consistently when the parameter is set to 10, and not at all
when set to 0.  For numbers in between, the higher the number, the
more it happens.
 
There is another problem in the 7171 that can cause Kermit file
transfers to abort after a flurry of retransmissions if XON/XOFF flow
control is used by the receiving Kermit, or even by hardware in between
the 7171 and the receiver.  To prevent this problem, set the 7171 flags
so that XOFF is not a valid terminator of a transparent read.  See page
4-20 of "IBM 7171 Reference Manual and Programming Guide" (IBM
publication number GA27-0021).
 
Kermit operation through a Renex protocol converter generally requires
that type-ahead be turned off.
 
Kermit operation is possible through an IBM 3708 front end in two
different configurations.  In the first, the terminal line must be set
for either "protocol enveloping" or "dynamic" mode, and a session must
be set for line-at-a-time operation for Kermit to work.  Other important
details of the terminal configuration are: (1) the terminal must be
specified as a TWX device, (2) the SSCP format should be set to USSNTO,
(3) the terminal type ID should be set to 05, (4) the line should be set
for 8, or possibly 7, data bits and 1 stop bit, (5) there should be no
"read prompt", and (6) the so-called "alternate" translation table
(number 3) should be selected.  Kermit-CMS may also need to be
configured because some models of the 3708 (or some environments) do not
pass the normal packet character SOH (code 1, CTRL-A).  A suitable
substitute is HT (code 9, CTRL-I).  Alternatively, or additionally, it
may help to set the 3708 "interface type" to 0.
 
The second possible 3708 configuration is "protocol conversion" mode and
makes use of the FULLSCREEN type in Kermit, which is also suitable for
many other kinds of protocol converter.  The basic setup consists of the
following Kermit subcommands.
 
     .... mainframe .....        ....... PC .........
     SET CONTROLLER FULL         set send start 62
     SET RECEIVE START 62        set receive start 62
     SET SEND START 62           set block b
     SET BLOCK B                 set handshake none
     SET HANDSHAKE 0
 
The 62's (Greater-than sign) may be replaced by some other decimal code
for a printable character.  For best results, choose a character that
seldom appears in the files you will be transferring.  In particular,
avoid the Control, Eighth-bit, and Repeat prefixes.  Packet sizes are
automatically restricted by Kermit-CMS, so you needn't set them unless
conditions require packets shorter than the default (77).  Flow control
may be needed to keep up with the data rate on some equipment.  The
block check type should be set to "B" only if the protocol converter is
overzealous in optimizing the data stream -- there are hazards in using
any type other than "1" because of all the packet echoing.  Refer to
IK0AAA.HLP for such details.  Note that the translation of characters
imposes the same setup requirements on FULLSCREEN mode as on the
traditional TTY mode (linemode).  See the DOC.
 
Kermit-CMS supports file transfers through the IBM 3174 AEA with B2 or
higher microcode, but support is restricted to terminals with the ASCII
Graphics capability in three ways that may require compensating
installation:
 
a) The terminal type must be defined in the 3174 to support graphics
   (only the built-in VT241 and Tektronix 4205 types plus suitable
   user-defined terminal types).  IBM's AEA Reference describes how
   to set up terminal tables.
 
b) The line must be defined without a Host Addressable Printer.
 
c) If the 3174 is owned by VTAM, the connection must be made with a
   logmode that allows the Read Partition Query (such as M2SDLCQ).
 
-------- cut here for IKCINS EXEC (invoke for easy installation) ------
&TRACE *
*----------------------------------------------------------------------
*                I K C I N S
* Complete Kermit installation EXEC (including XEDIT macro, all in one)
*   J.F.Chandler - 1992 August 18, revised Nov 10
*   Expanded for Help menus 1993 March - thanks to Adam Kujawski
*   More options: 1993 May
* CMS / EXEC 2 -- Compatible with CMS releases 2 onward.
* For an explanation of the operations in this EXEC, see IKCKER.INS and
* IKCKER.BWR in the Kermit distribution.  Obtain the distribution files
* (step 1 in "INS") before running this EXEC.
* Installation requires about 10mb of disk work space.
*
* Optional customization: to create a PRINT file of the update details
* and assemblies, change the definition of &PRKEEP at label -INSTALL
* from NO to YES.  In the standard version of this EXEC, the PRINT file
* is purged unless there are errors in the installation.
*
* Optional customization: to see the messages from UPDATE (each giving
* the name of an update file as it is applied), change the definition
* of &UPDMSG at label -INSTALL from NO to YES.  If you have local mods,
* it may be helpful to see those messages, in case there is an message
* among them.  Normally, this EXEC suppresses them all.
*
* Optional customization: to use extra options on the assembly step(s),
* insert them into the definition of &ASMOPTS at label -INSTALL.  These
* will be passed to the assembler "as is".
*----------------------------------------------------------------------
&IF &0 EQ IKCMENU &GOTO -MAKEMENU
&IF &0 NE IKCFAN &GOTO -INSTALL
*----------------- XEDIT MACRO TO FAN OUT UPDATE FILES ---------------
*----------------- INTENDED TO BE INVOKED AS A PROFILE ---------------
      &DISK = &8
      &L = &LENGTH OF .&DISK
      &IF &L NE 2 &IF &L NE 3 &DISK = O
      &DISK5 = &CONCAT OF &DISK 5
      &IF &L EQ 3 &DISK5 = &8
      &COMMAND MAKEBUF
      COMMAND PRESERVE
      COMMAND SET RECFM F
      COMMAND EXTRACT /FNAME/FTYPE/LINE
      COMMAND SET MSGMODE OFF
      COMMAND :1 SET ZONE 1 5
-LOOP &LOOP -Z *
        COMMAND STACK 1
        &READ VARS * &FN &FT
        &IF .&FT EQ . &GOTO -C
        &COMMAND ERASE &FN &FT &DISK
        COMMAND 1 PUT ;:READ; &FN &FT &DISK5
        &IF &RC NE 2 &SKIP 2
          COMMAND PUT * &FN &FT &DISK5
          &GOTO -C
-Z
-C    COMMAND :&LINE.1 RESTORE
      &COMMAND DROPBUF
      COMMAND MSG &0 complete for &FNAME.1 &FTYPE.1
      &STACK LIFO QUIT
      &EXIT 0
*
*---------------------------------------------- INSTALL HELP MENU
-MAKEMENU
COMMAND EXTRACT /FMODE
COMMAND :0 CASE M
COMMAND :0 TRUNC *
COMMAND :0 ZONE 1 6
COMMAND SET STAY ON
COMMAND SET MSGMODE OFF
COMMAND 1 DEL /:READ /
COMMAND REPEAT *
COMMAND DELETE *
COMMAND SET ARBCH ON $
COMMAND SET ZONE 45 *
COMMAND :1 C/$//*
COMMAND SET ZONE 1 *
COMMAND :1 C/:READ $ $/$/*
COMMAND MACRO JOIN 25
COMMAND REPEAT *
COMMAND :1 / SET / 1 PUTD / SHOW / SETCOM HELPTASK &FMODE.1
COMMAND XEDIT SETCOM HELPTASK &FMODE.1 (NOPROF
COMMAND SET MSGMODE OFF
&CALL -HELPPCH 33 list of SET parameters.
COMMAND FILE
&SETCOM25 = &STRING OF SETCOM TASK
&SETCOM25 = &LEFT OF &SETCOM25 23
COMMAND -1 I &SETCOM25 SET...
&CALL -HELPPCH 25 list of subcommands.
COMMAND /.../ C/ &BLANK / - List of SET subparameters/
COMMAND SAVE KERCOM HELPTASK &FMODE.1
COMMAND :1 DEL *
&SETCOM25 = &LEFT OF KERMITCM 23
COMMAND I &SETCOM25 KERMIT
&SETCOM25 = &STRING OF KERCOM TASK
&SETCOM25 = &LEFT OF &SETCOM25 23
COMMAND I &SETCOM25 SUBCMDS...
&CALL -HELPPCH 25 Help Menu.
COMMAND /.../ C/ &BLANK / &BLANK - List of subcommands/
&STACK FFILE KER HELPTASK &FMODE.1
&EXIT
-HELPPCH &MSG = &RANGE OF & 2 &N
COMMAND ZONE &1 *
COMMAND HEX ON
COMMAND :0 C/ $/X'4A6C'/*
COMMAND :0 I &BLANK
COMMAND I &BLANK &BLANK This is the Kermit-CMS &MSG
COMMAND I &BLANK &BLANK Place cursor on desired item and hit ENTER or PF1.
COMMAND ADD 2
&RETURN
*
*-------------------------------------------------- INSTALL KERMIT
*
-INSTALL
*---------- Set to keep output print file or not...
&PRKEEP = NO
*---------- Set to suppress update application messages...
&UPDMSG = NO
*---------- Set to string of extra assembler options....
&ASMOPTS = &STRING OF
*--------------- INITIALIZE SOME VARIABLES (SET DEFAULTS)
*  ALL THESE OPTIONS ARE CHECKED WITH THE INSTALLER
*
&STACK LIFO  NO  NO    NO   NO    YES   YES   YES  NO    NO   YES   YES
&READ VARS  &XA &SFS &KANJ &NMAC &BASE &CLOB &FAN &ACT &BOOT &HELP &PDS
&STACK LIFO  A   KERMIT HELPCMS   *   NO   NO       NO
&READ VARS &DISK &CNTRL &HELPFT &SRC &LCL &MENU &HELPONLY
*--------------------------------------- DECODE CMS LEVEL
&COMMAND Q CMSLEVEL (LIFO
&IF &RC NE 0 &STACK LIFO * * * *
&READ VARS * * &CMSLEVEL
&CMSLEVEL = &TRANS OF &CMSLEVEL ,
&CMSLEVEL = &TRIM OF &CMSLEVEL
* FOR CMS 7, CHECK IF HASM MISSING (OPTIONAL UNDER ESA 370 FEATURE)
&COMMAND ESTATE HASM MODULE *
&IF &RC NE 0 &IF .&CMSLEVEL GE .7 &CMSLEVEL = 7370
&COMMAND ESTATE DMSGPI MACLIB S
&XA2PLUS = &RC
*    &LVL VALUES:                 2  3  4  5  6    7  8   9  10
* NUCLEUS CMSLVL:                 -  6  7  8  8    9 10  10  11
*
&LVL = 1 + &POSITION OF &CMSLEVEL 3  4  5 5.5 5.6  6  7  7370 8
&IF &LVL EQ 1 &IF &XA2PLUS EQ 0 &LVL = 8
&XA     = &WORD OF           NO  NO NO NO YES YES NO YES NO  YES  &LVL
&SFS    = &WORD OF           NO  NO NO NO  NO NO YES YES YES YES  &LVL
&NMAC   = &WORD OF           NO  NO NO NO  NO YES NO YES YES YES  &LVL
* NOTE: THE LIST OF "AVAILABLE" CMS LEVELS NEED NOT BE EXTENDED PAST 8
* UNLESS NEW FUNCTIONS ARE ADDED TO KERMIT REQUIRING MACROS/DEFINITIONS
* MISSING FROM THE CMS 7 AND 8 MACLIBS.
*---------------------------------- DEDUCE CNTRL FILE NEEDED
&IF &SFS EQ YES &CNTRL = KERMCMS6
&IF &NMAC EQ YES &CNTRL = KERME370
&IF &XA EQ NO &SKIP 3
   &CNTRL = KERMXA
   &IF &NMAC EQ YES &CNTRL = KERMXA21
   &IF &SFS EQ YES &CNTRL = KERMESA
*-------------------------------------- SPOOL PRINTER
SENTRIES
&L = &RC
EXECIO * CP (LIFO ST QUERY VIRTUAL 00E
SENTRIES
&L = &RC - &L
&LOOP 2 &L
  &INFO2 = &INFO1
  &READ STRING &INFO1
&CHR = &PIECE OF &INFO1 9 1
&SPCONT = 16
&SPTO = 10
&IF .&CHR NE . &SPTO = &SPTO + 1
&SPCONT = &PIECE OF &INFO1 &SPCONT 6
&SPTO = &PIECE OF &INFO2 &SPTO 12
&COMMAND CP SPOOL 00E CONT TO *
*---------------------------------- ANNOUNCE AND CONFIRM OPTIONS
&COMMAND VMFCLEAR
&PRINT &0 EXEC:
&BEGPRINT -INFO
installs Kermit on a working disk of your choice using distribution source and
updates (assumed to be accessible).  The working disk should be at least 10MB.
There must be enough virtual storage for updating and assembling (a few MB:
depends on conditions).  Source files must be on a single disk (or on its R/O
extensions), but other Kermit updates may be on any accessed disk.
 
To halt installation, enter 'STOP' at any prompt...
 
Before installing, search 'IKCKER BWR' for relevant optional mods.  Local
updates should be listed in 'KERMIT AUXOPT' and be either already accessible
or bundled into 'KERMIT LOCAL' with ':READ' separators.
 
-INFO
&CALL -ASK HELPONLY  Install *only* the HELP file
&IF &HELPONLY EQ NO &CALL -CHECK IKCKER BWR *
&CALL -GETPARM SRC  mode  source filemode
-ASKDISK
&CALL -GETPARM DISK  disk  installation disk
&DISK = &LEFT OF &DISK 1
&DISK2 = &CONCAT OF &DISK 2
&DISK5 = &CONCAT OF &DISK 5
&TXTDSK = &DISK
&COMMAND MAKEBUF
&COMMAND LISTFILE KERMIT TEXT * (FIFO
&IF &RC EQ 0 &READ VARS * * &TXTDSK
&COMMAND DROPBUF
&IF &HELPONLY EQ NO &IF &TXTDSK LT &DISK &GOTO -ERR5
&COMMAND ESTATE KERMIT ASSEMBLE &DISK
&BRC = &RC
&IF &BRC NE 24 &IF &BRC NE 36 &IF &DISK NE * &SKIP 2
  &PRINT Invalid filemode &DISK
  &GOTO -ASKDISK
&COMMAND MAKEBUF
&COMMAND QUERY DISK &DISK (LIFO
&READ VARS * * * &R/W * * &BLKSI * * &FBLK &TBLK
&COMMAND DROPBUF
&IF .&R/W EQ .R/W &SKIP 2
   &PRINT Disk &DISK is not accessed R/W
   &GOTO -ASKDISK
&COMMAND ESTATE $KERMIT ASSEMBLE &DISK
&URC = &RC
&IF &HELPONLY EQ YES &GOTO -DISKOK
&IF .&TBLK NE .- &GOTO -CHKSIZE
&COMMAND MAKEBUF
*                                       Get Filepool id
&COMMAND QUERY ACCESSED &DISK ( LIFO
&READ VARS * * * * &DIR
&DIR = &TRANS OF &DIR : &BLANK
&STACK LIFO &DIR
&READ VARS &FP *
&FP = &CONCAT OF &FP :
*                                       Get available space
&COMMAND QUERY LIMITS * &FP ( LIFO
&READ VARS * * &TBLK &UBLK *
&UBLK = &TRANS OF &UBLK - &BLANK
&STACK LIFO &UBLK
&READ VARS &UBLK *
&COMMAND DROPBUF
&FBLK = &TBLK - &UBLK
-CHKSIZE
&TSIZ = &MULT OF 0&BLKSI 0&TBLK
&FSIZ = &MULT OF 0&BLKSI 0&FBLK
&MINSIZ = 2000000
&IF &BRC NE 0 &MINSIZ = &MINSIZ + 1000000
&IF &URC NE 0 &MINSIZ = &MINSIZ + 1000000
&IF &TSIZ GE 9000000 &IF &FSIZ GE &MINSIZ &SKIP 2
   &PRINT Disk &DISK is too small or too full
   &GOTO -ASKDISK
-DISKOK
&CALL -CHECK &0 EXEC *
&COMMAND COPYFILE &0 EXEC &FM IKCFAN XEDIT &DISK5 (REPLACE TOLABEL -INSTALL
&COMMAND COPYFILE &0 EXEC &FM IKCMENU XEDIT &DISK5 (REPLACE TOLABEL -INSTALL
&IF &HELPONLY EQ YES &GOTO -MAKEHELP
&X = &POSITION OF &CNTRL KERMIT KERMXA KERMXA21 KERMCMS6 KERMESA KERME370
&X = &WORD OF             <5.5   5.5     5.6       6      >6     7(370)   &X
&PRINT Control file '&CNTRL CNTRL' is suitable for CMS Rel. &X ...
&CALL -GETPARM CNTRL  filename  control filename
&IF .&NEW EQ . &SKIP 2
  &X = 1 + &POSITION OF &CNTRL KERMIT KERMXA KERMXA21 KERMCMS6 KERMESA KERME370
  &XA =     &WORD OF      NO     NO     YES    YES       NO      YES    NO   &X
&COMMAND VMFCLEAR
&IF &URC EQ 0 &CALL -ASK CLOB  Updated source already on disk &DISK - destroy it
&IF &CLOB EQ NO &GOTO -ERR1
&IF &BRC EQ 0 &CALL -ASK BASE  Base source already on disk &DISK - replace it
*---------------------------- MAKE SURE ALL SOURCE FILES ARE PRESENT
&IF &BASE EQ NO &GOTO -CHKEND
&CALL -ASK KANJ  Include Kanji support
&P1 = &STRING OF IK0DOC IK0MAC IKCMAC IK0DEF IK0MAI IK0COM IK0CMD IKCUTL
&X = &STRING OF &P1 IK0PRO
&IF &KANJ EQ YES &X = &STRING OF &P1 IK0KAN IK0PRO
&STACK LIFO &X
&READ ARGS
&I = 0
&LOOP 2 &N
  &I = &I + 1
  &CALL -CHECK &&I ASM &SRC
-CHKEND
&ASMCMD = ASSEMBLE
&IF &XA EQ YES &ASMCMD = HASM
&CALL -GETPARM ASMCMD  command  assemble command
*------------------------------ MAKE SURE UPDATES ARE PRESENT
&CALL -CHECK IKCKER UPD *
&IF &XA EQ YES &CALL -CHECK IKCXA UPD *
*-------------------------------------- MAKE SURE DISK IS DEFINED
&COMMAND ESTATEW * * &DISK
&IF &RC EQ 0 &SKIP 2
  &COMMAND ESTATE * * &DISK
  &IF &RC EQ 0 &GOTO -ERR2
*
*-------------- ************ S T E P   INS 2
*
*-------------------------------------- MAKE OPTIONAL ACCOUNTING EXIT
&CALL -ASK ACT  Include optional accounting exit
&IF &ACT EQ NO &GOTO -ACTEND
&CALL -CHECK IKCACT ASM &SRC
&COMMAND COPYFILE IKCACT ASM &FM KACCT ASSEMBLE &DISK5 (RECFM F LRECL 80 REP
&COMMAND ESTATE IKCACT UPD &SRC
&IF &RC NE 0 &GOTO -ACTEND
&PRINT Updating KACCT
&CALL -CHECK IKCACT UPD &SRC
&COMMAND COPYFILE IKCACT UPD &FM KACCT UPDATE &DISK5 (RECFM F LRECL 80 REP
&UPDOPTS = &STRING OF OUTMODE &DISK PRINT INC REP
&COMMAND UPDATE KACCT ASSEMBLE &DISK5 KACCT UPDATE &DISK ( &UPDOPTS
&UPDRC = &RC
&COMMAND ERASE KACCT UPDATE &DISK
&IF &UPDRC GT 12 &GOTO -ERR3
-ACTEND
*-------------------------------------- MAKE BASE SOURCE(S)
&COPYOP = &STRING OF RECFM F LRECL 80 REP
&IF &LVL GE 3 &GOTO -BOOTEND
&BOOT = YES
&CALL -ASK BOOT  Generate high-memory bootstrap
&IF &BOOT EQ NO &GOTO -BOOTEND
&PRINT **NOTE** KERMIT TEXT must be kept together with MODULE
&CALL -CHECK IKCBOO ASM &SRC
&COMMAND ESTATE KERMBOOT ASSEMBLE &DISK
&IF &RC NE 0 &SKIP 1
 &IF &BASE EQ NO &SKIP 1
  &COMMAND COPYFILE IKCBOO ASM &FM KERMBOOT ASSEMBLE &DISK5 ( &COPYOP
-BOOTEND
&IF &BASE EQ NO &GOTO -MAKEND
&PRINT Merging base source
&I = 0
&LOOP 4 &N
  &I = &I + 1
  &CALL -CHECK &&I ASM &SRC
  &COMMAND COPYFILE &&I ASM &FM KERMIT ASSEMBLE &DISK5 ( &COPYOP
  &COPYOP = &STRING OF APPEND
-MAKEND
*
*-------------- ************ S T E P   BWR 4
*
*----------------------------------- FAN OUT UPDATE FILES
&COMMAND VMFCLEAR
&COMMAND ESTATE KERMIT AUXOPT *
&AUXOPT = &RC
&CALL -ASK LCL  Any local updates to apply
&IF &LCL EQ NO &SKIP 2
  &IF &AUXOPT NE 0 &CALL -CHECK KERMIT LOCAL *
  &SKIP 1
    &IF &AUXOPT EQ 0 &PRINT *** Warning: 'KERMIT AUXOPT' exists anyway.
&COMMAND ESTATE KERMIT AUXLCL &DISK
&IF &RC EQ 0 &CALL -ASK FAN  Re-extract individual update files
&IF &FAN EQ NO &GOTO -FANEND
&PRINT Extracting individual update files
&COMMAND XEDIT IKCKER UPD * ( PROFILE IKCFAN ) &DISK
&IF &XA EQ YES &COMMAND XEDIT IKCXA UPD * ( PROFILE IKCFAN ) &DISK
*
*-------------- ************ S T E P   BWR 5
*
&COMMAND ESTATE IKCKER NUP *
&IF &RC NE 0 &SKIP 2
  &CALL -ASK FAN  Extract updates from IKCKER NUP
  &IF &FAN EQ YES &COMMAND XEDIT IKCKER NUP * ( PROFILE IKCFAN ) &DISK
&IF &LCL EQ NO &SKIP 2
  &COMMAND ESTATE KERMIT LOCAL *
  &IF &RC EQ 0 &COMMAND XEDIT KERMIT LOCAL * ( PROFILE IKCFAN ) &DISK
-FANEND
*------------------- ONE LAST CHECK: CNTRL FILE FROM FAN
&CALL -CHECK &CNTRL CNTRL &DISK
&IF &LCL EQ YES &CALL -CHECK KERMIT AUXOPT *
*
*-------------- ************ S T E P   INS 3
*
*----------------------------------------- MAKE HELP FILE
-MAKEHELP
&CALL -GETPARM HELPFT  filetype  help filetype
&COMMAND ESTATE KERMIT &HELPFT &DISK
&IF &RC EQ 0 &CALL -ASK HELP  HELP file already on disk &DISK - replace it
&IF &HELP EQ NO &GOTO -HELPEND
&CALL -CHECK IKCKER HLP &SRC
&IF &LVL GE 3 &SKIP 2
  &COMMAND COPYFILE IKCKER HLP &FM KERMIT &HELPFT &DISK2 (REP
  &GOTO -HELPEND
&COMMAND HELPCONV IKCKER HLP &FM
&CALL -ASK PDS  Convert help file to PDS form
&IF &PDS EQ YES &SKIP 2
  &COMMAND COPYFILE IKCKER $HLP A KERMIT &HELPFT &DISK2 (REP
  &GOTO -HELPEND
&CALL -ASK PDS  Remove confusing help section separators
&COMMAND VMFCLEAR
&PRINT Installing KERMIT &HELPFT ...
&COMMAND MAKEBUF
&BUFNO = &RC
&STACK FIFO SET MSGMODE OFF
&STACK FIFO SET RECFM F
&STACK FIFO SET CASE M
* WARNING: THERE ARE LOWER-CASE CHARACTERS IN 2 OF THE NEXT 4 LINES
&IF &PDS EQ NO &SKIP 2
  &STACK FIFO LOCATE -2/.cs / DEL
  &STACK FIFO REPEAT *
&STACK FIFO :0 C/.cm /*COPY /*
&STACK FIFO SET MSGMODE ON
&STACK FIFO FFILE TEMPKERM COPY &DISK5
&COMMAND XEDIT IKCKER $HLP (NOPROF
&COMMAND DROPBUF &BUFNO
&COMMAND MACLIB GEN TEMPKERM TEMPKERM
&COMMAND COPYFILE TEMPKERM MACLIB A KERMIT &HELPFT &DISK2 (REP
&COMMAND ERASE TEMPKERM MACLIB A
&COMMAND ERASE TEMPKERM COPY &DISK
-HELPEND
&IF &LVL LE 3 &GOTO -MENUEND
&CALL -ASK MENU  Create HELP menu system
&IF &MENU EQ NO &GOTO -MENUEND
&COMMAND ESTATE IKCKER $HLP A
&IF &RC EQ 0 &SKIP 2
  &CALL -CHECK IKCKER HLP &SRC
  &COMMAND HELPCONV IKCKER HLP &FM
&PRINT Installing KER HELPTASK ...
&COMMAND MAKEBUF
&BUFNO = &RC
&STACK FIFO SET MSGMODE OFF
&STACK FIFO SET CASE M
&STACK FIFO SET ARBCHAR ON $
* WARNING: THERE ARE LOWER-CASE CHARACTERS IN THE NEXT LINE
&STACK FIFO :0 C/.cm $ /:READ $ &HELPFT /*
&STACK FIFO SET MSGMODE ON
&STACK FIFO FFILE TEMPKERM HELP &DISK2
&COMMAND XEDIT IKCKER $HLP (NOPROF
&COMMAND DROPBUF &BUFNO
&COMMAND ERASE SETCOM HELPTASK &DISK
&COMMAND XEDIT TEMPKERM HELP &DISK2 ( PROFILE IKCMENU
&COMMAND XEDIT TEMPKERM HELP &DISK2 ( PROFILE IKCFAN ) &DISK2
&COMMAND ERASE TEMPKERM HELP &DISK
-MENUEND
&COMMAND ERASE IKCKER $HLP A
&IF &HELPONLY EQ YES &EXIT
*
*-------------- ************ S T E P   BWR 6
*
*----------------------------------------- APPLY UPDATES
&COMMAND ERASE $KERMIT ASSEMBLE &DISK
&COMMAND ERASE KERMIT TEXT &DISK
&PRINT Updating KERMIT ASSEMBLE
&DQ = &CONCAT OF &DISK '
&PRINT File 'KERMIT UPDATES &DQ will have the list of updates applied...
&IF &UPDMSG EQ NO &COMMAND SET CMSTYPE HT
&UPDOPTS = &STRING OF CTL STK OUTMODE &DISK PRINT INC
&COMMAND UPDATE KERMIT ASSEMBLE &DISK &CNTRL CNTRL &DISK ( &UPDOPTS
&UPDRC = &RC
&COMMAND SET CMSTYPE RT
&IF &UPDRC GT 12 &GOTO -ERR3
*
*-------------- ************ S T E P   INS 4
*
*------------------------------- RETRIEVE MACLIB LIST FROM STACK
&COMMAND SENTRIES
&IF &RC LE 1 &GOTO -ERR3
&READ VARS
&READ ARGS
&IF &N LE 1 &GOTO -ERR3
&MACLIBS = &RANGE OF & 2 9
&COMMAND GLOBAL MACLIB &MACLIBS
*
*-------------- ************ S T E P   INS 5
*
*----------------------------------------------- ASSEMBLE KERMIT
&PRINT Assembling...
&NAME = KERMIT
&COMMAND &ASMCMD $KERMIT ( NOESD NORLD PRINT &ASMOPTS
&IF &RC NE 0 &GOTO -ERR4
&COMMAND ERASE $KERMIT ASSEMBLE &DISK
&COMMAND RENAME $KERMIT TEXT &DISK KERMIT = &DISK2
&LOADS = KERMIT
&IF &ACT EQ NO &SKIP 4
  &LOADS = &STRING OF &LOADS KACCT
  &NAME = KACCT
  &COMMAND &ASMCMD KACCT ( NOESD NORLD PRINT &ASMOPTS
  &IF &RC NE 0 &GOTO -ERR4
&IF &BOOT EQ NO &SKIP 4
  &LOADS = KERMBOOT
  &NAME = KERMBOOT
  &COMMAND &ASMCMD KERMBOOT ( NOESD NORLD PRINT &ASMOPTS
  &IF &RC NE 0 &GOTO -ERR4
&COMMAND CP CLOSE 00E NA KERMIT LISTING
*
*-------------- ************ S T E P   INS 6
*
&PRINT Loading Kermit ...
&IF &LVL GE 3 &RLDSAVE = RLDSAVE
&COMMAND LOAD &LOADS (CLEAR NOMAP &RLDSAVE
&R = &RC
&COMMAND GENMOD KERMIT MODULE &DISK2
&IF &RC GT &R &R = &RC
&IF &R EQ 0 &IF &PRKEEP EQ NO &SKIP 1
  &COMMAND CP SPOOL 00E CLOSE
&COMMAND CP SPOOL 00E PURGE &SPCONT &SPTO
&EXIT &RC
*-------------------------------------------------------------------
*-------------------------------------- CONFIRM EXISTENCE OF A FILE
-CHECK
&COMMAND ESTATE &1 &2 &3
&IF &RC EQ 0 &SKIP 3
  &X = &CONCAT OF &3 '
  &PRINT File '&1 &2 &X not found.
  &GOTO -DONE
&FM = &3
&IF .&3 NE .* &RETURN
&COMMAND MAKEBUF
&COMMAND LISTFILE &1 &2 &3 (FIFO
&READ VARS * * &FM
&COMMAND DROPBUF
&RETURN
*----------------------------------- ASK FOR POSSIBLE OVERRIDE (PARM)
-GETPARM &X = &CONCAT OF ' &&1 '
&MSGTXT = &RANGE OF & 3 &N
&PRINT Default &MSGTXT is &X - enter alternate &2 if desired:
-GETPM1 &IF &1 EQ ASMCMD &SKIP 2
  &READ VAR &NEW
  &SKIP 1
    &READ STRING &NEW
&IF .&NEW NE .* &SKIP 2
  &PRINT '*' not allowed, except as default.  Re-enter, or type STOP:
  &GOTO -GETPM1
&IF .&NEW EQ .STOP &GOTO -QUIT
&IF .&NEW NE . &&1 = &NEW
&RETURN
*----------------------------------- ASK FOR POSSIBLE OVERRIDE (YES/NO)
-ASK &MSG = &RANGE OF & 2 &N
&DEFMSG = &CONCAT OF (default: &BLANK &&1 )?
  &PRINT &MSG &DEFMSG
  &READ VAR &NEWVAL
  &X = &POSITION OF .&NEWVAL .  .Y .YES .N .NO .STOP
&IF &X EQ 0 &SKIP -3
&IF .&NEWVAL EQ .STOP &GOTO -QUIT
&&1    = &WORD OF           &&1 YES YES NO  NO  ...  &X
&RETURN
*-------------------------------------- ERROR EXITS
-QUIT &PRINT Stopping...
   &GOTO -DONE
-ERR1 &PRINT &0 would destroy $KERMIT ASSEMBLE &DISK
   &GOTO -DONE
-ERR2 &PRINT Mode letter &disk not defined
   &GOTO -DONE
-ERR3 &PRINT Error in UPDATE - rc=&UPDRC
   &IF &UPDRC NE 0 &PRINT Enter 'HELP UPDATE' for explanation.
   &GOTO -DONE
-ERR4 &PRINT Error in assembling &NAME - rc=&RC
   &GOTO -DONE
-ERR5 &FID = &CONCAT OF 'KERMIT &BLANK TEXT &BLANK &TXTDSK '
   &PRINT &FID precedes disk &DISK in search order.
   &PRINT Remove or rename.
-DONE
   &COMMAND CP CLOSE 00E NA KERMIT LISTING
   &COMMAND CP SPOOL 00E CLOSE
   &COMMAND CP SPOOL 00E &SPCONT &SPTO
   &EXIT 100
